package com.lsh.airticket.service.impl;

import com.lsh.airticket.dao.SpaceDao;
import com.lsh.airticket.entity.Space;
import com.lsh.airticket.service.SpaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author lsh
 * @date 2021/2/18
 **/
@Service
public class SpaceServiceImpl implements SpaceService {

    @Autowired
    SpaceDao spaceDao;
    @Override
    public List<Space> findSpaceList() {
        return spaceDao.findTbSpaceAll();
    }

    @Override
    public int insertSpace(Space space) {
        space.setSpaceCreatetime(new Date());
        return spaceDao.insertTbSpace(space);
    }

    @Override
    public List<Space> findSpaceByModelId(Integer modelId) {
        return spaceDao.findSpaceByModelId(modelId);
    }

    @Override
    public int updateSpace(Space space) {
        return spaceDao.updateTbSpace(space);
    }

    @Override
    public int deleteSpaceById(Integer spaceId) {
        return spaceDao.deleteTbSpaceById(spaceId);

    }
}
